package com.zx.map.dao;

import java.util.List;

import org.springframework.dao.DataAccessException;

import com.zx.map.dao.model.AgentInfo;
import com.zx.map.dao.model.AgentInfoExample;

public interface AgentInfoDao {

	/**
	 * 新增
	 * @return
	 * @throws DataAccessException
	 */
	public String add(AgentInfo agentInfo) throws DataAccessException;

	/**
	 * 更新
	 * @return
	 * @throws DataAccessException
	 */
	public String update(AgentInfo agentInfo) throws DataAccessException;

	/**
	 * 删除
	 * @throws DataAccessException
	 */
	public void delete(AgentInfo agentInfo) throws DataAccessException;

	/**
	 * 分页查询
	 * 
	 * @param pageSize
	 * @param pageBegin
	 * @param example
	 * @return
	 * @throws DataAccessException
	 */
	public List<AgentInfo> getPageByExample(int pageSize, int pageBegin,
			AgentInfoExample example) throws DataAccessException;

	/**
	 * 根据Model查找List
	 * @throws DataAccessException
	 */
	public List<AgentInfo> getListByExample(AgentInfoExample example) throws DataAccessException;

	/**
	 * 根据条件查找下级代理商id集合
	 */
	public List<String> getDownAgentIdList(AgentInfoExample example) throws DataAccessException;
	
	/**
	 * 查找条数
	 * 
	 * @param example
	 * @return
	 * @throws DataAccessException
	 */
	public int countByExample(AgentInfoExample example) throws DataAccessException;

	/**
	 * 根据单Key查找Model
	 * @return
	 * @throws DataAccessException
	 */
	public AgentInfo selectByPrimaryKey(String key) throws DataAccessException;

	public int updateByExampleSelective(AgentInfo agentInfo,AgentInfoExample agentInfoExample);

	/**
	 * 更改从属关系
	 * @param fromBsid
	 * @param toBsid
	 * @return
	 */
	int updateAgentBelong(String fromBsid, String toBsid);
}